package com.tdkj.model.shop;

import java.math.BigDecimal;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import com.tdkj.model.base.BaseEntity;
import com.tdkj.model.user.BeanUser;

/**
 * Orders entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "shop_order")
public class BeanOrder extends BaseEntity {

	private String code;
	
	//物流方式，0 1 2
	private Integer logisticsApproach;
	
	private BigDecimal logisticsPrice;
	
	private Timestamp createTime;
	private Timestamp cutoffPaymentTime;
	
	private BigDecimal fare;
	private Integer state;
	
	private BeanUser seller;
	private BeanUser buyer;
	
	private List<BeanOrderItem> items = new ArrayList<BeanOrderItem>();
	
	private BeanOrderConsigneeInfo consigneeInfo;
	
	private BigDecimal totalFee;

	public BigDecimal getFare() {
		return fare;
	}

	public void setFare(BigDecimal fare) {
		this.fare = fare;
	}

	public Integer getState() {
		return state;
	}

	public void setState(Integer state) {
		this.state = state;
	}

	@ManyToOne(fetch=FetchType.LAZY, cascade={CascadeType.REFRESH})
	@JoinColumn(name="buyer_id")
	public BeanUser getBuyer() {
		return buyer;
	}

	public void setBuyer(BeanUser buyer) {
		this.buyer = buyer;
	}

	
	@OneToMany(fetch=FetchType.LAZY, cascade={CascadeType.ALL}, mappedBy="order")
	public List<BeanOrderItem> getItems() {
		return items;
	}


	public void setItems(List<BeanOrderItem> items) {
		this.items = items;
	}


	public String getCode() {
		return code;
	}


	public void setCode(String code) {
		this.code = code;
	}


	public Timestamp getCreateTime() {
		return createTime;
	}


	public void setCreateTime(Timestamp createTime) {
		this.createTime = createTime;
	}

	@ManyToOne(fetch=FetchType.EAGER, cascade={CascadeType.REFRESH})
	@JoinColumn(name="consigneeInfo_id")
	public BeanOrderConsigneeInfo getConsigneeInfo() {
		return consigneeInfo;
	}

	public void setConsigneeInfo(BeanOrderConsigneeInfo consigneeInfo) {
		this.consigneeInfo = consigneeInfo;
	}

	@ManyToOne(fetch=FetchType.EAGER, cascade={CascadeType.REFRESH})
	@JoinColumn(name="seller_id")
	public BeanUser getSeller() {
		return seller;
	}

	public void setSeller(BeanUser seller) {
		this.seller = seller;
	}

	public BigDecimal getTotalFee() {
		return totalFee;
	}

	public void setTotalFee(BigDecimal totalFee) {
		this.totalFee = totalFee;
	}

	public Timestamp getCutoffPaymentTime() {
		return cutoffPaymentTime;
	}

	public void setCutoffPaymentTime(Timestamp cutoffPaymentTime) {
		this.cutoffPaymentTime = cutoffPaymentTime;
	}

	public Integer getLogisticsApproach() {
		return logisticsApproach;
	}

	public void setLogisticsApproach(Integer logisticsApproach) {
		this.logisticsApproach = logisticsApproach;
	}

	public BigDecimal getLogisticsPrice() {
		return logisticsPrice;
	}

	public void setLogisticsPrice(BigDecimal logisticsPrice) {
		this.logisticsPrice = logisticsPrice;
	}
	

}